package org.deltaset.desktop;

import java.util.List;

/**
 *
 * @author dmakariev
 */
public class DesktopHandler {

    //private final TopMenuProvider topMenuProvider;
    private final DesktopContext defaultDesktopContext;
    private final List<AppItem> topMenu;

    public DesktopHandler(final TopMenuProvider topMenuProvider) {
        //this.menuGroups = initMenuGroups();
        //this.currentMenuItem = new MenuItem("simple", "simple.xhtml");
        //this.topMenuProvider=topMenuProvider;
        //TODO:better default configuration..
        this.topMenu = topMenuProvider.loadTopMenu();//AppFactory.initTopMenu();
        final AppItem currentApp = this.topMenu.get(0);
        final MenuItem currentMenuItem = currentApp.getDefaultMenuItem();
        final String pageSrc = currentMenuItem.getTemplateSrc();
        final DesktopContext dc = new DesktopContext(currentMenuItem, currentApp, pageSrc);
        this.defaultDesktopContext = dc;
    }

    public List<AppItem> getTopMenu() {
        return topMenu;
    }

    public DesktopContext getDefaultDesktopContext() {
        return defaultDesktopContext;
    }
}
